﻿<!--#include file="utf-8.asp"-->
<!--#include file="conn.asp"-->
<!--#include file="seeion.asp"--> 
<%
Name_=request.form("Name")
eName=request.form("eName")
SortID=request.form("SortID")
FrontPage=request.form("FrontPage")
Photo=request.form("Photo")
Description_=request.form("Description")
eDescription=request.form("eDescription")

if request("type") = "add" then
	set rs=server.createobject("adodb.recordset")
	sql="select Name,eName,SortID,FrontPage,Photo,Description,eDescription from Celeb"
	rs.open sql,conn,1,3
	call panduan()
	rs.addnew
	rs("Name")=Name_
	rs("eName")=eName
	rs("SortID")=SortID
	rs("FrontPage")=FrontPage
	rs("Photo")=Photo
	rs("Description")=Description_
	rs("eDescription")=eDescription
	rs.update
	Response.Write "<script>alert('添加名人成功！点击 [确定] 继续添加！');window.location.href='admin_Celeb.asp';</script>" 
else
	sql="select id,Name,eName,SortID,FrontPage,Photo,Description,eDescription from Celeb where id="&request.Form("id")&""
	set rs=server.createobject("adodb.recordset")
	rs.open SQL,conn,2,3
	if rs.eof and rs.bof then
		Response.Write "<script language='javascript'>alert('参数错误!');document.location.href('Manage_shop.asp');</script>"
		Response.End()
	end if
	rs("Name")=Name_
	rs("eName")=eName
	rs("SortID")=SortID
	rs("FrontPage")=FrontPage
	rs("Photo")=Photo
	rs("Description")=Description_
	rs("eDescription")=eDescription
	rs.update 
	response.write "<script>alert('修改名人成功！点击 [确定] 返回名人管理');window.location.href='admin_Celeb.asp?type=update&id="&request("id")&"';</script>" 
end if
rs.close
set rs=nothing
conn.close
set rs=nothing

function panduan()
	if Name_=""  then 
		response.Write("<script language=javascript>alert('名人标题不能为空!');history.go(-1)</script>") 
		response.end 
	end if
	if Description_="" then 
		response.Write("<script language=javascript>alert('名人描述不能为空!');history.go(-1)</script>") 
		response.end 
	end if
end function

%>
